package jwdt.xadmin.rskq.service.impl;

import java.util.List;

import jwdt.common.dao.BaseDao;
import jwdt.xadmin.custom.bean.TCustom;
import jwdt.xadmin.rskq.bean.TKqjb;
import jwdt.xadmin.rskq.service.KqcxManageService;
import jwdt.xadmin.system.bean.TSystem;

import com.ezerg.db.Jdb;
import com.ezerg.db.ext.PageUtil;
import com.ezerg.web.Form;
import com.ezerg.web.Module;

public class KqcxManageServiceImpl implements KqcxManageService {

	private BaseDao<TCustom> baseDao;
	
	public void setBaseDao(BaseDao<TCustom> baseDao) {
		this.baseDao = baseDao;
	}
	
	
	
	@Override
	public List getFlmx(int flid) {
		return Jdb.get().query("SELECT MXMC, MXDM FROM jwdt_zd_flmx where FLID=?", new Object[]{flid});
	}
	
	@Override
	public PageUtil page(Form f, Module m) throws Exception{
		TSystem Tsystem=(TSystem) Jdb.get().get(TSystem.class, 1);
		int page = f.getInt("page", 1);
		int pageSize = f.getInt("pageSize", Tsystem.getAdminnum());

		String sql = " order by id desc";

		PageUtil pu = new PageUtil(TKqjb.class, sql, page, pageSize);
		return pu.setUrl(m.getFullPath() + ".do");
	}
	@Override
	public List tdep() throws Exception{
		return Jdb.get().query("SELECT * FROM t_dep");
	}
	
	@Override
	public List tuser(String sql) throws Exception{
		
		return Jdb.get().query("SELECT * FROM t_user"+sql);
	}
	
	@Override
	public List sbsjcx(String timea,String timeb) throws Exception{
		if (!"".equals(timea) && !"".equals(timeb))
			return   Jdb.get().query("SELECT * FROM t_kq_dj where recorddate between '"+timea + " 00:00:00' and '" + timeb+" 23:59:59'");
		else
			return Jdb.get().query("SELECT * FROM t_kq_dj order by id desc");
		
	}


	
}
